﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class _Default : System.Web.UI.Page
{
    connDB myConn = new connDB();
    CUSMessageBox MsgBox = new CUSMessageBox();
    email myMail = new email(); string visit;
    string major, state, athInt, howhear, phone, cphone, term, sGuid;
 
    protected override void OnInit(EventArgs e)
    {
        PreInit += new EventHandler(Page_PreInit);
        base.OnInit(e);
    }

    void Page_PreInit(object sender, EventArgs e)
    {
        Session["srvName"] = Request.ServerVariables["server_name"];

    }

    protected void Page_Load(object sender, EventArgs e)
    {


        //if (Session["srvName"].ToString() == "www.avila.edu")
        //{
        //    if (Request.IsSecureConnection == false)
        //    {
        //        string redirectUrl = Request.Url.ToString().Replace("https:", "http:");
        //        Response.Redirect(redirectUrl);

        //    }


        //}


        //Calendar1.Attributes.Add("onclick", "javascript:Confirm('From 12/17/2012 to  12/21/2012 AND From 1/2/2013 to 1/4/2013. You can only meet with the representative because the rest of the staff and students are on break! ');");
        //Calendar2.Attributes.Add("onclick", "javascript:Confirm('From 12/17/2012 to  12/21/2012 AND From 1/2/2013 to 1/4/2013. You can only meet with the representative because the rest of the staff and students are on break! ');");

        txtArea.Attributes.Add("onkeyup", "return parea()");
        txtPrefix.Attributes.Add("onkeyup", "return pprefix()");
        txtSuffix.Attributes.Add("onkeyup", "return psuffix()");
        txtArea0.Attributes.Add("onkeyup", "return marea()");
        txtPrefix0.Attributes.Add("onkeyup", "return mprefix()");
        txtSuffix0.Attributes.Add("onkeyup", "return msuffix()");

        txtArea.Attributes.Add("onkeyup", "return parea()");
        txtPrefix.Attributes.Add("onkeyup", "return pprefix()");
        txtSuffix.Attributes.Add("onkeyup", "return psuffix()");
        txtArea0.Attributes.Add("onkeyup", "return marea()");
        txtPrefix0.Attributes.Add("onkeyup", "return mprefix()");
        txtSuffix0.Attributes.Add("onkeyup", "return msuffix()");
        //Accept only number you cannot type letters
        //txtArea.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
        //txtPrefix.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
        //txtSuffix.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
        //txtArea0.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
        //txtPrefix0.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
        //txtSuffix0.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");

        //txtZip.Attributes.Add("onkeydown", "return isNumeric(event.keyCode);");
       

        //Label1.Text = "Transfer Students";// +Convert.ToDateTime("3/16/2013").ToShortDateString();
        //Label1.Text = Session["rdgrpStu"].ToString();
        // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "setMinDateOnSecondControl", "function setMinDateOnSecondControl(e) { document.getElementById('" + txtEndDate.ClientID + "').dateSelectionChanged += function x(e) { alert(e);} ; }", true);

        if (!IsPostBack)
        {
            PopulateTime();
            myConn.PopulateMajor(ddMajor);
            ddMajor.Items.Add(new ListItem("Select One...", " "));
            ddMajor.SelectedValue = " ";
            ddMajor_SelectedIndexChanged(ddMajor, e);
            ddState2_SelectedIndexChanged(ddState2, e);
            ddHowHear_SelectedIndexChanged(ddHowHear, e);
            ddAthInt_SelectedIndexChanged(ddAthInt, e);
            ddTerm_SelectedIndexChanged(ddTerm, e);
            pnlNU.Visible = false;
        }



    }

    private void PopulateTime()
    {
        ddVisitTime.Items.Add(" ");
        for (int i = 9; i < 13; i++)
        {

            if (i > 8 && i < 12)
                ddVisitTime.Items.Add(i.ToString() + " AM");
            //if (i == 12)
            //    ddVisitTime.Items.Add(i.ToString() + " Noon");


        }
        for (int j = 1; j < 3; j++)
        {
            ddVisitTime.Items.Add(j.ToString() + " PM");

        }

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidTime())
        {

            if (Page.IsValid)
            {

                setstate();

                //save();

                string strToMe = "Mallika.Ramaswamy@Avila.edu";
                string strTo = "Admission@Avila.edu ";
                string strSubject = "Campus Visit Request From Transfer Student " + DateTime.Now.ToString();
                string strFrom = txtEmail.Text.Trim();
                string msgStr = "";
                msgStr = msgStr + "<table width=108% border=0 align=left cellpadding=0 cellspacing=0 style=font-family:arial;font-size:11px;>";
                msgStr += "<tr align=center ><td  valign=top colspan=4 bgcolor=#5B148B ><div align=center><font color=#FFFFFF face=arial size=2><b>The following Details were submitted on: " + DateTime.Now.ToShortDateString();
                msgStr += "&nbsp;&nbsp;</b></font></div></td></tr></table><br />";
                msgStr = msgStr + "<table width=108% border=0 align=left cellpadding=0 cellspacing=0 style=font-family:arial;font-size:11px;><tr>";
                msgStr = msgStr + " <td width=3 rowspan=73 valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td colspan=2 align=left valign=top bgcolor=#F4F4F4><b>Contact Information</b> </td>";
                msgStr = msgStr + " <td width=17 align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td width=159 align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td width=151 align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";

                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + "<td width=100% colspan=5><br /></td></tr><tr>";
                msgStr = msgStr + "<td width=145 align=left valign=middle><strong>First Name</strong></td>";
                msgStr = msgStr + "<td width=200 align=left valign=top>";
                msgStr = msgStr + txtFName.Text.Trim();
                msgStr = msgStr + "</td><td align=left valign=middle>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=middle><strong>Street 1</strong></td>";
                msgStr = msgStr + "<td align=left valign=top>";
                msgStr = msgStr + txtStreet1.Text.Trim();
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td align=left valign=middle ><strong>Middle Name</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>";
                msgStr = msgStr + txtMName.Text.Trim();
                msgStr = msgStr + "</td> <td align=left valign=middle>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=middle><strong>Street 2</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>" + txtStreet2.Text.Trim();
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td align=left valign=middle ><strong>Last Name</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>";
                msgStr = msgStr + txtLName.Text.Trim();
                msgStr = msgStr + "</td> <td align=left valign=middle>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=middle><strong>City</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>" + txtCity.Text.Trim();
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td align=left valign=middle ><strong>Home Phone</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>";
                msgStr = msgStr + phone;
                msgStr = msgStr + "</td> <td align=left valign=middle>&nbsp;</td>"; ;
                msgStr = msgStr + " <td align=left valign=middle><strong>State/Province</strong></td>"; ;
                msgStr = msgStr + " <td align=left valign=top>" + ddState2.SelectedValue;
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td align=left valign=middle ><strong>Mobile Phone</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>";
                msgStr = msgStr + cphone;
                msgStr = msgStr + "</td> <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top ><strong>Zip Code</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>" + txtZip.Text.Trim();
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td align=left valign=top ><strong>E-Mail address</strong></td>";
                msgStr = msgStr + " <td align=left valign=top>" + txtEmail.Text.Trim();
                msgStr = msgStr + "</td> <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top ></td></tr><tr>";


                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "</tr><tr>";


                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "</tr><tr>";

                msgStr = msgStr + " <td colspan=2 align=left valign=top bgcolor=#F4F4F4><strong>Education Information</strong></td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4><a href=#></a></td>";

                msgStr = msgStr + "</tr><tr>";

                msgStr = msgStr + " <td colspan=2 align=left valign=middle ><strong>School Currently or Last Attended</strong><br />";
                msgStr = msgStr + txtSchool.Text.Trim();
                msgStr = msgStr + "</td> <td colspan=3 align=left valign=top >";

                msgStr = msgStr + "<strong>Planned Term To Enter Avila:</strong> <br> " + ddTerm.SelectedValue + "</td></tr><tr>";
                msgStr = msgStr + "<td colspan=2 align=left valign=middle >&nbsp;</td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "</tr><tr>";

                msgStr = msgStr + "<tr><td colspan=2 align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + " <td colspan=2 align=left valign=top ><strong>Intended Major</strong></td>";
                msgStr = msgStr + " <td colspan=3 align=left valign=top ><strong>Athletic Interests</strong><br /></td>";
                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + "<td colspan=2 align=left valign=top class=style13>" + ddMajor.SelectedItem.Text;
                if (ddAthInt.SelectedValue.ToString() != "")
                {
                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top >" + ddAthInt.SelectedValue;
                }
                else
                {
                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top >Not Given";

                }
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + " <td colspan=2 align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + " <td colspan=2 align=left valign=top bgcolor=#F4F4F4><strong>Visit and Miscellaneous Information</strong></td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4>&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top bgcolor=#F4F4F4><a href=#></a></td>";
                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + "<td colspan=5 align=left valign=top><br />";




                msgStr = msgStr + "</td></tr><tr>";

                msgStr = msgStr + "<td align=left valign=top class=style13>&nbsp;</td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";



                msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top><b >Would you like a campus visit?</b></td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top><b>Are you being recruited by AU Athletics ?</b></td> </tr>";
                msgStr = msgStr + "<tr><td colspan=2 align=left valign=top>" + rbVisit.SelectedValue + "</td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top>" + rbAthletic.SelectedValue + "</td>";

                msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top ><strong>When would you like to visit?</strong></td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top ><strong>Choose a visit start time:</strong></td>";
                if (ddMajor.SelectedItem.Text != "Nursing")
                {
                    msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top >" + txtVisitDate.Text.Trim();

                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top >" + ddVisitTime.SelectedValue;
                }
                else
                {
                    msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top >" + txtNVisit.Text.Trim();

                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top >" + ddNVisit.SelectedValue;

                }

                msgStr = msgStr + "</td></tr><tr><td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td colspan=2 align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top >&nbsp;</td>";

                msgStr = msgStr + "</tr><tr>";
                msgStr = msgStr + "<td height=2 colspan=5 align=left valign=top><strong>What other information would help us plan your visit to meet with such as an academic, athletic, or other person?&nbsp; </strong></td>";
                msgStr = msgStr + "</tr><tr><td colspan=3 align=left valign=top>";
                //msgStr = msgStr + "  <textarea name=txtarOther id=txtarOther cols=45 rows=5 tabindex=28>" + txtarOther.Text.Trim();
                msgStr = msgStr + txtarOther.Text.Trim();
                msgStr = msgStr + "</td><td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "</tr><tr><td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";
                msgStr = msgStr + "<td align=left valign=top>&nbsp;</td>";


                msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top ><strong>Who is filling out this form?</strong></td>";
                msgStr = msgStr + "<td colspan=3 align=left valign=top ><strong>How did you hear about Avila? </strong></td>";
                msgStr = msgStr + "</tr><tr><td colspan=2 align=left valign=top >" + rbWho.Text.Trim();
                if (ddHowHear.SelectedValue.ToString() != "")
                {
                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top >" + ddHowHear.SelectedValue.ToString();
                }
                else
                {
                    msgStr = msgStr + "</td><td colspan=3 align=left valign=top > Not Given";
                }
                msgStr = msgStr + "</td></tr><tr>";
                msgStr = msgStr + "<td colspan=2 align=left valign=top >&nbsp;</td>";
                msgStr = msgStr + " <td align=left valign=top >&nbsp;</td></tr></table>";
                string msgStu = "";
                msgStu = " Thank you for submitting the Campuvisit on " + DateTime.Now.ToString() + "<br/>";
                msgStu += " We will review your information and Admission rep will contact you soon. <br/>";
                msgStu += msgStr;
                //Confirmation Email send to student/visitor
                myMail.sendMail(msgStu, strTo, strFrom, strSubject);
                //to Admission office

                myMail.sendMail(msgStr, strFrom, strTo, strSubject);
                myMail.sendMail(msgStr, strFrom, strToMe, strSubject);
               // myMail.sendMail(msgStr, strFrom, "Laura.Harrity@avila.edu", strSubject);
                Response.Redirect("thanks.aspx");
                Session.Abandon();
                // Response.Redirect("https://www.avila.edu/admission/campusvisit/thanksNew.asp");
            }

        }
        else
        {


            ddVisitTime.Focus(); ddNVisit.Focus();
            lblErrTime.BackColor = Color.Yellow;
            lblErrTime.ForeColor = Color.Red;
            lblErrTime.Text = "ALERT! From 12/9/13 to 1/8/14, You can choose start time Morning 9AM & 10AM (OR) Afternoon 1PM & 2PM ";
            lblNErr.BackColor = Color.Yellow;
            lblNErr.ForeColor = Color.Red;
            lblNErr.Text = "ALERT! From 12/9/13 to 1/8/14, You can choose start time Morning 9AM & 10AM (OR) Afternoon 1PM & 2PM ";



        }
    }



    private void setstate()
    {
        Session["term"] = ddTerm.SelectedValue.ToString();
        Session["FirstName"] = txtFName.Text.Trim();

        if (txtMName.Text != "")
            Session["MName"] = txtMName.Text.Trim();
        else
        {
            txtMName.Text = "-----";
            Session["MName"] = txtMName.Text.Trim();
        }



        Session["LastName"] = txtLName.Text.Trim();
        Session["Street"] = txtStreet1.Text.Trim();
        if (txtStreet2.Text != "")
        {
            Session["Add2"] = txtStreet2.Text.Trim();
        }
        else
        {
            txtStreet2.Text = "-----";
            Session["Add2"] = txtStreet2.Text.Trim();

        }
        Session["City"] = txtCity.Text;
        Session["State"] = ddState2.SelectedValue.ToString();
        Session["Zip"] = txtZip.Text;
        Session["Email"] = txtEmail.Text;
        Session["LastSchool"] = txtSchool.Text;

        //Session["GPA"] = txtGPA.Text;
        Session["Major"] = ddMajor.SelectedValue.ToString();
        if (ddAthInt.SelectedValue.ToString() != "")
        {
            Session["AthInt"] = ddAthInt.SelectedValue.ToString();
        }
        else
        {


            Session["AthInt"] = "Not Given";


        }
        if (ddHowHear.SelectedValue.ToString() != "")
        {
            Session["HowHear"] = ddHowHear.SelectedValue.ToString();
        }
        else
        {


            Session["HowHear"] = "Not Given";


        }

        Session["rbVisit"] = rbVisit.SelectedValue.ToString();
        Session["rbAthletic"] = rbAthletic.SelectedValue.ToString();
        //Session["Applied"] = rbApplied.SelectedValue.ToString();
        if (ddMajor.SelectedItem.Text == "Nursing")
        {

            Session["VisitDate"] = txtNVisit.Text;
            Session["VisitTime"] = ddNVisit.SelectedValue.ToString();

        }
        else
        {
            Session["VisitDate"] = txtVisitDate.Text;
            Session["VisitTime"] = ddVisitTime.SelectedValue.ToString();
        }
        Session["WhoFill"] = rbWho.SelectedValue.ToString();

        if (txtarOther.Text != "")
            Session["listOther"] = txtarOther.Text.Trim();
        else
        {
            txtarOther.Text = "----------";
            Session["listOther"] = txtarOther.Text.Trim();
        }


        if (txtArea.Text != "" && txtPrefix.Text != "" && txtSuffix.Text != "")
        {
            phone = txtArea.Text + '-' + txtPrefix.Text + '-' + txtSuffix.Text;
            Session["Phone"] = phone;
        }

        else
        {
            phone = "Not Provided";
            Session["Phone"] = phone;


        }

        if (txtArea0.Text != "" && txtPrefix0.Text != "" && txtSuffix0.Text != "")
        {
            cphone = txtArea0.Text + '-' + txtPrefix0.Text + '-' + txtSuffix0.Text;
            Session["CPhone"] = cphone;
        }

        else
        {
            cphone = "Not Provided";
            Session["CPhone"] = cphone;


        }



        //Session["Stu"] = Label1.Text.Trim();

    }

    protected void ddState2_SelectedIndexChanged(object sender, EventArgs e)
    {
        state = ddState2.SelectedValue.ToString();

    }
    protected void ddMajor_SelectedIndexChanged(object sender, EventArgs e)
    {
        major = ddMajor.SelectedValue.ToString();




    }
    protected void ddMajor_SelectedIndexChanged1(object sender, EventArgs e)
    {
        if (ddMajor.SelectedItem.Text == "Nursing")
        {
            pnlNU.Visible = true;
            pnlDefault.Visible = false;



        }
        else
        {
            pnlNU.Visible = false;
            pnlDefault.Visible = true;


        }
    }
    protected void ddTerm_SelectedIndexChanged(object sender, EventArgs e)
    {
        term = ddTerm.SelectedValue.ToString();
    }
    protected void ddAthInt_SelectedIndexChanged(object sender, EventArgs e)
    {
        athInt = ddAthInt.SelectedValue.ToString();
    }
    protected void ddHowHear_SelectedIndexChanged(object sender, EventArgs e)
    {
        howhear = ddHowHear.SelectedValue.ToString();
    }

   


    private void save()
    {
        // In case Client press the back button ,lock the data for the particular application
        Application.Lock();
        setstate();

        if (Convert.ToString(Session["appGuid"]) != "")
            sGuid = Session["appGuid"].ToString();
        else
        {
            Session["appGuid"] = Guid.NewGuid();
            sGuid = Session["appGuid"].ToString();
        }
        string gyear = null; string stype = "Transfer";
        string ACT = null;
        string SAT = null;

        if (ddMajor.SelectedItem.Text != "Nursing")
        {
            visit = txtVisitDate.Text + " @ " + ddVisitTime.SelectedValue;
            myConn.AddInfo(sGuid, txtFName.Text, txtLName.Text, txtPre.Text, txtMName.Text, txtStreet1.Text, txtStreet2.Text, txtCity.Text, ddState2.SelectedValue,
          txtZip.Text, txtEmail.Text, txtSchool.Text, gyear, cphone, phone, ACT,
          SAT, ddMajor.SelectedValue, ddTerm.SelectedValue, stype, ddAthInt.SelectedValue, visit, txtarOther.Text, ddHowHear.SelectedValue, rbWho.SelectedValue, rbVisit.SelectedValue, rbAthletic.SelectedValue);

        }
        else //if (ddMajor.SelectedValue.ToString() == "NU")
        {
            visit = txtNVisit.Text + " @ " + ddNVisit.SelectedValue;
            myConn.AddInfo(sGuid, txtFName.Text, txtLName.Text, txtPre.Text, txtMName.Text, txtStreet1.Text, txtStreet2.Text, txtCity.Text, ddState2.SelectedValue,
          txtZip.Text, txtEmail.Text, txtSchool.Text, gyear, cphone, phone, ACT,
          SAT, ddMajor.SelectedValue, ddTerm.SelectedValue, stype, ddAthInt.SelectedValue, visit, txtarOther.Text, ddHowHear.SelectedValue, rbWho.SelectedValue, rbVisit.SelectedValue, rbAthletic.SelectedValue);

        }





        Application.UnLock();

    }

    private bool ValidTime()
    {

        //if (Calendar1.SelectedDate >= Convert.ToDateTime("12/9/13") && Calendar1.SelectedDate <= Convert.ToDateTime("1/8/2014") && (ddVisitTime.SelectedValue == "12 Noon" || ddVisitTime.SelectedValue == "Noon" || ddVisitTime.SelectedValue == "11 AM" || ddVisitTime.SelectedValue == "3 PM"))
        //{

        //    string msg = "From 12/9/2013 to  1/8/2014. ";
        //    msg += "\n" + "You can choose start time Morning 9 AM & 10 AM or Afternoon 1 PM & 2 PM!   ";
        //    lblMsg.Visible = true;
        //    lblMsg.Text = msg;
        //    ddVisitTime.SelectedValue = " "; ddVisitTime.Focus();

        //    return false;
        //}

        //else
        //{

        //    lblErrTime.Visible = false;
        //    lblErrTime.Text = "";
        //}

        //if (Calendar2.SelectedDate >= Convert.ToDateTime("12/9/13") && Calendar2.SelectedDate <= Convert.ToDateTime("1/8/2014") && (ddNVisit.SelectedValue == "Noon" || ddNVisit.SelectedValue == "11 AM"))
        //{
        //    //Calendar1.Attributes.Add("onclick", "javascript:alert('From 12/9/2013 to  1/8/2014. You can choose between 9 AM - 11 AM or 1 PM - 3 PM! ');");
        //    string msg = "From 12/9/2013 to  1/8/2014. ";
        //    msg += "\n" + "You can choose start time Morning 9 AM & 10 AM or Afternoon 1 PM   ";

        //    lblNMsg.Visible = true;
        //    lblNMsg.Text = msg;
        //    ddNVisit.SelectedValue = ""; ddNVisit.Focus();

        //    return false;
        //}
        //else
        //{

        //    lblNErr.Visible = false;
        //    lblNErr.Text = "";
        //}
        return true;
    }


    protected void ddNVisit_SelectedIndexChanged(object sender, EventArgs e)
    {
        //if (Calendar2.SelectedDate >= Convert.ToDateTime("12/9/13") && Calendar2.SelectedDate <= Convert.ToDateTime("1/8/2014") && (ddNVisit.SelectedValue == "Noon" || ddNVisit.SelectedValue == "11 AM"))
        //{
        //    //ddVisitTime.Attributes.Add("onclick", "javascript:alert('From 12/9/2013 to  1/8/2014. You can choose between 9 AM - 11 AM or 1 PM - 3 PM! ');");
        //    //Response.Write("<script>alert('This a message')</script>");

        //if (Calendar2.SelectedDate == Convert.ToDateTime("5/16/14") && (ddNVisit.SelectedValue == "1 PM" || ddNVisit.SelectedValue == "2 PM"))
        //{

        //    string msg = "On May 16th 2014. ";
        //    msg += "\n" + "You can choose only Morning 9 AM & 10 AM !  ";


        //    lblNMsg.Text = msg;
        //    lblNMsg.Visible = true;
        //    lblNMsg.ForeColor = Color.Red;
        //    //MessageBox.Show(msg, "ALERT", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
        //    ddNVisit.SelectedValue = "";
        //    ddNVisit.Focus();

        //}
        //else
        //{

        //    lblNMsg.Visible = false;
        //    lblNMsg.Text = "";

        //}
    }
    protected void ddVisitTime_SelectedIndexChanged(object sender, EventArgs e)
    {
        //if (Calendar1.SelectedDate == Convert.ToDateTime("5/16/14") && (ddVisitTime.SelectedValue == "1 PM" || ddVisitTime.SelectedValue == "2 PM")) //>= Convert.ToDateTime("12/9/13") && Calendar1.SelectedDate <= Convert.ToDateTime("1/8/2014")) && (ddVisitTime.SelectedValue == "12 Noon" || ddVisitTime.SelectedValue == "11 AM" || ddVisitTime.SelectedValue == "3 PM"))
        //{
        //    //Calendar1.Attributes.Add("onclick", "javascript:alert('From 12/9/2013 to  1/8/2014. You can choose between 9 AM - 11 AM or 1 PM - 3 PM! ');");

        //    string msg = "On May 16th 2014. ";
        //    msg += "\n" + "You can choose only 9 AM & 10 AM !   ";
        //    lblMsg.Text = msg;
        //    lblMsg.Visible = true;
        //    lblMsg.ForeColor = Color.Red;
        //    //MessageBox.Show(msg, "ALERT", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
        //    ddVisitTime.SelectedValue = " "; ddVisitTime.Focus();

        //}
        //else
        //{

        //    lblMsg.Visible = false;
        //    lblMsg.Text = "";
        //}

    }
   
}
